3.5.34 \(\int \cos ^2(c+d x) (a+b \tan ^2(c+d x)) \, dx\) [434]

Optimal. Leaf size=33 \[ \frac {1}{2} (a+b) x+\frac {(a-b) \cos (c+d x) \sin (c+d x)}{2 d} \]

[Out]

1/2*(a+b)*x+1/2*(a-b)*cos(d*x+c)*sin(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 33, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3756, 393, 209} \begin {gather*} \frac {(a-b) \sin (c+d x) \cos (c+d x)}{2 d}+\frac {1}{2} x (a+b) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2*(a + b*Tan[c + d*x]^2),x]

[Out]

((a + b)*x)/2 + ((a - b)*Cos[c + d*x]*Sin[c + d*x])/(2*d)

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 393

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[(-(b*c - a*d))*x*((a + b*x^n)^(p
 + 1)/(a*b*n*(p + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(a*b*n*(p + 1)), Int[(a + b*x^n)^(p + 1), x], x]
 /; FreeQ[{a, b, c, d, n, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/n + p, 0])

Rule 3756

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[ff/(c^(m - 1)*f), Subst[Int[(c^2 + ff^2*x^2)^(m/2 - 1)*(a + b*(ff*x)
^n)^p, x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, e, f, n, p}, x] && IntegerQ[m/2] && (IntegersQ[n, p
] || IGtQ[m, 0] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps

\begin {align*} \int \cos ^2(c+d x) \left (a+b \tan ^2(c+d x)\right ) \, dx &=\frac {\text {Subst}\left (\int \frac {a+b x^2}{\left (1+x^2\right )^2} \, dx,x,\tan (c+d x)\right )}{d}\\ &=\frac {(a-b) \cos (c+d x) \sin (c+d x)}{2 d}+\frac {(a+b) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (c+d x)\right )}{2 d}\\ &=\frac {1}{2} (a+b) x+\frac {(a-b) \cos (c+d x) \sin (c+d x)}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.04, size = 32, normalized size = 0.97 \begin {gather*} \frac {2 (a+b) (c+d x)+(a-b) \sin (2 (c+d x))}{4 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2*(a + b*Tan[c + d*x]^2),x]

[Out]

(2*(a + b)*(c + d*x) + (a - b)*Sin[2*(c + d*x)])/(4*d)

________________________________________________________________________________________

Maple [A]
time = 0.16, size = 54, normalized size = 1.64

method result size
risch \(\frac {a x}{2}+\frac {b x}{2}+\frac {\sin \left (2 d x +2 c \right ) a}{4 d}-\frac {\sin \left (2 d x +2 c \right ) b}{4 d}\) \(40\)
derivativedivides \(\frac {b \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(54\)
default \(\frac {b \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(54\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(a+b*tan(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(b*(-1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c)+a*(1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c))

________________________________________________________________________________________

Maxima [A]
time = 0.49, size = 39, normalized size = 1.18 \begin {gather*} \frac {{\left (d x + c\right )} {\left (a + b\right )} + \frac {{\left (a - b\right )} \tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c)^2),x, algorithm="maxima")

[Out]

1/2*((d*x + c)*(a + b) + (a - b)*tan(d*x + c)/(tan(d*x + c)^2 + 1))/d

________________________________________________________________________________________

Fricas [A]
time = 2.85, size = 30, normalized size = 0.91 \begin {gather*} \frac {{\left (a + b\right )} d x + {\left (a - b\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c)^2),x, algorithm="fricas")

[Out]

1/2*((a + b)*d*x + (a - b)*cos(d*x + c)*sin(d*x + c))/d

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan ^{2}{\left (c + d x \right )}\right ) \cos ^{2}{\left (c + d x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(a+b*tan(d*x+c)**2),x)

[Out]

Integral((a + b*tan(c + d*x)**2)*cos(c + d*x)**2, x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 169 vs. \(2 (29) = 58\).
time = 0.63, size = 169, normalized size = 5.12 \begin {gather*} \frac {a d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + b d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + a d x \tan \left (d x\right )^{2} + b d x \tan \left (d x\right )^{2} + a d x \tan \left (c\right )^{2} + b d x \tan \left (c\right )^{2} - a \tan \left (d x\right )^{2} \tan \left (c\right ) + b \tan \left (d x\right )^{2} \tan \left (c\right ) - a \tan \left (d x\right ) \tan \left (c\right )^{2} + b \tan \left (d x\right ) \tan \left (c\right )^{2} + a d x + b d x + a \tan \left (d x\right ) - b \tan \left (d x\right ) + a \tan \left (c\right ) - b \tan \left (c\right )}{2 \, {\left (d \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + d \tan \left (d x\right )^{2} + d \tan \left (c\right )^{2} + d\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c)^2),x, algorithm="giac")

[Out]

1/2*(a*d*x*tan(d*x)^2*tan(c)^2 + b*d*x*tan(d*x)^2*tan(c)^2 + a*d*x*tan(d*x)^2 + b*d*x*tan(d*x)^2 + a*d*x*tan(c
)^2 + b*d*x*tan(c)^2 - a*tan(d*x)^2*tan(c) + b*tan(d*x)^2*tan(c) - a*tan(d*x)*tan(c)^2 + b*tan(d*x)*tan(c)^2 +
 a*d*x + b*d*x + a*tan(d*x) - b*tan(d*x) + a*tan(c) - b*tan(c))/(d*tan(d*x)^2*tan(c)^2 + d*tan(d*x)^2 + d*tan(
c)^2 + d)

________________________________________________________________________________________

Mupad [B]
time = 11.94, size = 32, normalized size = 0.97 \begin {gather*} \frac {\sin \left (2\,c+2\,d\,x\right )\,\left (\frac {a}{4}-\frac {b}{4}\right )+d\,x\,\left (\frac {a}{2}+\frac {b}{2}\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^2*(a + b*tan(c + d*x)^2),x)

[Out]

(sin(2*c + 2*d*x)*(a/4 - b/4) + d*x*(a/2 + b/2))/d

________________________________________________________________________________________